Page({
    data: {
        page_index: "bbgj"
    },
    onShow: function() {
        wx.getStorageSync("position") && this.getLesson();
    },
    onLoad: function(t) {
        var e = this;
        this.setData({
            interview: wx.getStorageSync("interview")
        }), wx.request({
            url: "https://apixue.huatu.com/wx/course/get/" + wx.getStorageSync("position"),
            method: "GET",
            data: {},
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                e.setData({
                    cids: t.data.data.cids
                });
            }
        });
    },
    open: function(t) {
        var e = t.currentTarget.dataset.id;
        wx.navigateToMiniProgram({
            appId: e,
            path: "pages/index/index",
            success: function(t) {
                console.log(t);
            }
        });
    },
    openClass: function(t) {
        var e = t.currentTarget.dataset.id, a = t.currentTarget.dataset.cid, n = t.currentTarget.dataset.gid;
        wx.navigateToMiniProgram({
            appId: e,
            path: "pages/course/course?courseid=" + a + "&goodsid=" + n,
            success: function(t) {
                console.log(t);
            }
        });
    },
    getLesson: function() {
        var t = this, e = wx.getStorageSync("position").substring(0, 2), a = 0;
        "ios" == wx.getSystemInfoSync().platform && (a = 1), wx.request({
            url: "https://defen.huatu.com/api/snj/v1/open/online/CountryExamCourseList",
            method: "GET",
            data: {
                exam_type_id_set: 8,
                adapt_place: e,
                is_free: a
            },
            success: function(e) {
                200 == e.data.code && t.setData({
                    rec: e.data.data
                });
            }
        });
    },
    onShareAppMessage: function() {
        return {
            title: "国考小助手",
            path: "/pages/index/index"
        };
    }
});